﻿using SqlSugar;

namespace Civic.Platform.Teach.Dao.Base
{
    public class DBConnectionConfig
    {
        public static SqlSugarClient SqlSugarClient(string connectionString)
        {
            ConnectionConfig config = new ConnectionConfig
            {
                ConnectionString = connectionString,
                DbType = DbType.MySql,
                IsAutoCloseConnection = true
            };
            return new SqlSugarClient(config);
        }

        public static SqlSugarClient SqlSugarClient(string connectionString, DbType dbType, bool isAutoClose = true)
        {
            ConnectionConfig config = new ConnectionConfig
            {
                ConnectionString = connectionString,
                DbType = dbType,
                IsAutoCloseConnection = isAutoClose
            };
            return new SqlSugarClient(config);
        }
    }
}